/**
  ******************************************************************************
  * @file           : queue.h
  * @brief          : Header for queue.c file.
  *                   This file contains the common defines of the application.
  ******************************************************************************
  * @attention
  *	Created by Chen Lu in 20210612
  *
  ******************************************************************************
  */

#ifndef __QUEUE_H
#define __QUEUE_H

#include "stdio.h"
#include "malloc.h"
#include "assert.h"
#include "stdlib.h"

typedef struct{
	uint8_t type;
	float value[8];		//used to store angles and speed
}TiTask;

typedef TiTask DataType;

typedef struct QueueNode
{
	struct QueueNode* _next;
	DataType _data;
}QueueNode;

typedef struct Queue
{
	QueueNode* first; // 队头
	QueueNode* last;  // 队尾
}Queue;

void QueueInit(Queue* pq);
void QueueDestory(Queue* pq);

QueueNode* BuyQueueNode(DataType x);
void QueuePush(Queue* pq, DataType x);
void QueueInsertFront(Queue* pq, DataType x);
DataType QueuePop(Queue* pq);
DataType QueueFront(Queue* pq);
int QueueEmpty(Queue* pq);
int QueueSize(Queue* pq);
void QueueSetEmpty(Queue* pq);

#endif /* __QUEUE_H */
